home *** CD-ROM | disk | FTP | other *** search
Wrap
aaaallllGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeeeBBBByyyyNNNNaaaammmmeeee((((3333ddddmmmm)))) aaaallllGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeeeBBBByyyyNNNNaaaammmmeeee((((3333ddddmmmm)))) NNNNAAAAMMMMEEEE alGetResourceByName - find an audio resource by name SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS ####iiiinnnncccclllluuuuddddeeee <<<<ddddmmmmeeeeddddiiiiaaaa////aaaauuuuddddiiiioooo....hhhh>>>> iiiinnnntttt aaaallllGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeeeBBBByyyyNNNNaaaammmmeeee((((iiiinnnntttt ssssttttaaaarrrrtttt____rrrreeeessss,,,, cccchhhhaaaarrrr ****nnnnaaaammmmeeee,,,, iiiinnnntttt ttttyyyyppppeeee)))) PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRR _s_t_a_r_t__r_e_s expects a resource at which the name search is to begin. Typically this is AL_SYSTEM, the top of the audio resource hierarchy. _n_a_m_e is a character string describing the resource to be found. _t_y_p_e is the type of the desired resource. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN aaaallllGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeeeBBBByyyyNNNNaaaammmmeeee searches the resources accessible from _s_t_a_r_t__r_e_s for a resource of type _t_y_p_e which has a resource matching the given _n_a_m_e accessible to it. See aaaallllRRRReeeessssoooouuuurrrrcccceeeessss((((3333ddddmmmm)))) for general information on resources, resource types, and the resource hierarchy. There are three ways for _n_a_m_e to match a given resource. The first is when _n_a_m_e exactly matches the resource's name (AL_NAME). The second is when _n_a_m_e exactly matches the resource's label (AL_LABEL). The third is when _n_a_m_e specifies a type which matches the type of the resource. The search is performed in this order. Periods in the name act as qualifiers. A name of the form (A.B) matches resource B if and only if it is accessible from resource A. EEEEXXXXAAAAMMMMPPPPLLLLEEEE NNNNAAAAMMMMEEEESSSS "AnalogIn" matches a resource named "AnalogIn" "in.analog" matches an analog interface accessible from an input device. "out.analog" matches an analog interface accessible from an output device. "RAD1.microphone" matches a microphone interface accessible from a resource called "RAD1" "A2.out.analog" matches an analog interface accessible from an output device accessible from a resource called "A2" PPPPaaaaggggeeee 1111 aaaallllGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeeeBBBByyyyNNNNaaaammmmeeee((((3333ddddmmmm)))) aaaallllGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeeeBBBByyyyNNNNaaaammmmeeee((((3333ddddmmmm)))) EEEEXXXXAAAAMMMMPPPPLLLLEEEE CCCCOOOODDDDEEEE The following code fragment finds a device _d_e_v which can access the resource which matches _n_a_m_e, and, if the named resource is an interface, selects that interface on the device. For example, if _n_a_m_e were "microphone," this code will look for a device _d_e_v with a microphone input, and select that input on the device. int dev; dev = alGetResourceByName(AL_SYSTEM, name, AL_DEVICE_TYPE); if (!dev) { printf("invalid device %s0, name); exit(-1); } if (itf = alGetResourceByName(AL_SYSTEM, name, AL_INTERFACE_TYPE)) { /* * the named resource is an interface. Select the interface on the * given device. */ ALpv p; p.param = AL_INTERFACE; p.value.i = itf; if (alSetParams(dev, &p, 1) < 0 || p.sizeOut < 0) { printf("set interface failed0); } } [... now do something with src...] DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS If aaaallllGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeeeBBBByyyyNNNNaaaammmmeeee is successful, it returns a non-zero resource. If it fails, it returns 0 and sets an error code which can be retrieved with oooosssseeeerrrrrrrroooorrrr((((3333CCCC)))). The error codes returned include: aaaallllGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeeeBBBByyyyNNNNaaaammmmeeee can fail for the following reasons: AAAALLLL____BBBBAAAADDDD____BBBBUUUUFFFFFFFFEEEERRRRLLLLEEEENNNNGGGGTTTTHHHH _n_a_m_e is too long. AAAALLLL____BBBBAAAADDDD____DDDDEEEEVVVVIIIICCCCEEEE____AAAACCCCCCCCEEEESSSSSSSS There is no audio system available, or it is improperly configured. AAAALLLL____BBBBAAAADDDD____RRRREEEESSSSOOOOUUUURRRRCCCCEEEE _s_t_a_r_t__r_e_s is an invalid resource. AAAALLLL____BBBBAAAADDDD____NNNNOOOOTTTT____FFFFOOOOUUUUNNNNDDDD A resource could not be found which met the given criteria. PPPPaaaaggggeeee 2222 aaaallllGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeeeBBBByyyyNNNNaaaammmmeeee((((3333ddddmmmm)))) aaaallllGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeeeBBBByyyyNNNNaaaammmmeeee((((3333ddddmmmm)))) SEE ALSO oserror(3C), alIntro(3dm), alSetDevice(3dm), alResources(3dm) PPPPaaaaggggeeee 3333